var availableTags;
var xhr;
var keyword1 = document.getElementById("tags");
console.info("进入");
function displayCom(){
    xhr = new XMLHttpRequest();
    xhr.onreadystatechange = processCom;
    xhr.open("GET","/catalog/searchCompletion?keyword="+keyword1.value,true);
    xhr.send(null);
}

function processCom() {
    if (xhr.readyState == 4) {
        if (xhr.status == 200) {
            var str = xhr.responseText;
            availableTags = str.split(",");
            $("#tags").autocomplete({//调用补全功能
                source: availableTags
            });
        }
    }
}
keyword1.oninput = displayCom;
